public interface Interpolator
{
    public String getName ();
    public float interpolate (float ratio, float low, float hi);
}

class LinearInterpolator implements Interpolator
{
    public String getName ()
    {
        return "Linear";
    }
    
    public static float really_interpolate (float ratio, float low, float hi)
    {
        return low + (hi - low) * ratio;
    }
    public float interpolate  (float ratio, float low, float hi)
    {
        return LinearInterpolator.really_interpolate(ratio, low, hi);
    }
}

class CubicInterpolator implements Interpolator
{
    public String getName ()
    {
        return "Cubic";
    }
    
    public float interpolate (float ratio, float low, float hi)
    {
        ratio = (-2 * ratio*ratio*ratio + 3 * ratio*ratio);
        return LinearInterpolator.really_interpolate(ratio, low, hi);
    }
}

class SinusoidalInterpolator implements Interpolator
{
    public String getName ()
    {
        return "Sinusoidal";
    }
    
    public float interpolate (float ratio, float low, float hi)
    {
        //ratio = (float)Math.asin(ratio);
        ratio = (float)Math.sin(ratio * ((float)Math.PI / 2.0f));
        return LinearInterpolator.really_interpolate(ratio, low, hi);
    }
}

class QuarterCircleInterpolator implements Interpolator
{
    public String getName ()
    {
        return "Quarter Circle";
    }
    
    public float interpolate (float ratio, float low, float hi)
    {
        if (ratio <= 0.0f)
        {
            return low;
        }
        else if (ratio >= 1.0f)
        {
            return hi;
        }
        else
        {
            ratio -= 1.0f;
            ratio = (float)Math.sqrt(1.0f - ratio*ratio);
            return LinearInterpolator.really_interpolate(ratio, low, hi);
        }
    }
}

class QuadraticInterpolator implements Interpolator
{
    public String getName ()
    {
        return "Quadratic";
    }
    
    public static float sqr (float n)
    {
        return n * n;
    }

    public float interpolate (float ratio, float low, float hi)
    {
        ratio = -sqr(ratio - 1.0f) + 1.0f;
        return LinearInterpolator.really_interpolate(ratio, low, hi);
    }
}
